package per.hx.bs.web.sys.service;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.*;
import per.hx.bs.entity.sys.SysNotifyRecordDO;

import java.util.List;
import java.util.Map;

/**
 * @author HuXing
 * @date 2018/3/30  16:25
 */
@Primary
@FeignClient(value = "Huxingbs-Sys-Service")
public interface SysNotifyRecordService {

    /**
     * 获取通知状态
     *
     * @param id id
     * @return 通知状态
     */
    @GetMapping(value = "sys-service/notifyRecord/get/{id}")
    SysNotifyRecordDO get(@PathVariable("id") Long id);

    /**
     * 获取通知状态
     *
     * @param map 条件
     * @return 通知集合
     */
    @PostMapping(value = "sys-service/notifyRecord/list")
    List<SysNotifyRecordDO> list(@RequestBody Map<String, Object> map);

    /**
     * 按条件统计
     *
     * @param map 条件
     * @return 数量
     */
    @PostMapping(value = "sys-service/notifyRecord/count")
    int count(@RequestBody Map<String, Object> map);


    /**
     * 保存通知状态
     *
     * @param sysNotifyRecordDO 保存通知状态
     * @return 影响行数
     */
    @PostMapping(value = "sys-service/notifyRecord/save")
    int save(@RequestBody SysNotifyRecordDO sysNotifyRecordDO);

    /**
     * 更新
     *
     * @param sysNotifyRecordDO 更新通知状态
     * @return 影响行数
     */
    @PutMapping(value = "sys-service/notifyRecord/update")
    int update(@RequestBody SysNotifyRecordDO sysNotifyRecordDO);

    /**
     * 删除
     *
     * @param id     id
     * @param userId 用户id
     * @return 影响行数
     */
    @DeleteMapping(value = "sys-service/notifyRecord/remove/{id}/{userId}")
    int remove(@PathVariable("id") Long id, @PathVariable("userId") Long userId);

    /**
     * 更改阅读状态
     *
     * @param sysNotifyRecordDO 通知状态
     * @return 影响行数
     */
    @PutMapping(value = "sys-service/notifyRecord/changeRead")
    int changeRead(@RequestBody SysNotifyRecordDO sysNotifyRecordDO);

    /**
     * 批量标记为已读
     *
     * @param ids    通知id
     * @param userId 用户id
     * @return 影响行数
     */
    @GetMapping(value = "sys-service/notifyRecord/batchRead")
    int batchRead(@RequestParam("ids[]") Long[] ids, @RequestParam("userId") Long userId);

    /**
     * 批量删除
     *
     * @param ids    通知id
     * @param userId 用户id
     * @return 影响行数
     */
    @GetMapping(value = "sys-service/notifyRecord/batchRemoveRecord")
    int batchRemoveRecord(@RequestParam("ids[]") Long[] ids, @RequestParam("userId") Long userId);

}
